<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>自定义指令</title>
</head>

<body>
  <!-- 打开之后我就聚焦 -->
  <div id="app">
    <input type="text" v-focus >
  </div>

  <script src="/vue.js"></script>
  <script>
     Vue.directive('focus',{
      
    inserted(el){
      el.focus()
    }
    })





const app = new Vue({
      el: '#app',
      data: {
        title: '你好世界'
      }
    })
  </script>
</body>

</html>